grub2: Port away from gs_file_sync_data()
authorColin Walters <walters@verbum.org>
Mon, 1 Aug 2016 01:31:45 +0000 (21:31 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Wed, 3 Aug 2016 08:10:27 +0000 (08:10 +0000)
Inlining this is uglier, but this code kind of sucks anyways =( We're
going to need to do some fd-relative porting in here at some point.

Closes: #424
Approved by: giuseppe

src/libostree/ostree-bootloader-grub2.c

index 30edb7a560dcf3a255c8ebe60d65bb0c99d19ca4..b2c68ac9dc0c93118a0affec6977d9f086e11b9e 100644 (file)
@@ -389,8 +389,18 @@ _ostree_bootloader_grub2_write_config (OstreeBootloader      *bootloader,
     goto out;
 
   /* Now let's fdatasync() for the new file */
-  if (!gs_file_sync_data (new_config_path, cancellable, error))
-    goto out;
+  { glnx_fd_close int new_config_fd = open (gs_file_get_path_cached (new_config_path), O_RDONLY | O_CLOEXEC);
+    if (new_config_fd < 0)
+      {
+        glnx_set_prefix_error_from_errno (error, "Opening %s", gs_file_get_path_cached (new_config_path));
+        goto out;
+      }
+    if (fdatasync (new_config_fd) < 0)
+      {
+        glnx_set_error_from_errno (error);
+        goto out;
+      }
+  }
 
   if (self->is_efi)
     {